<template>
  <div id="wrap">
    <div class="logo-wrp d-flex align-items-center">
      <img class="logo" src="/static/images/login-logo.png" alt="logo" />
      <h3 class="name">蜜蜂借呗</h3>
    </div>
    <div class="top"></div>
    <div class="cd"></div>
    <div class="inp">
      <div class="d-flex align-items-center">
        <span></span>
        <input type="text" class="flex-fill" v-model="mobile" placeholder="请输入手机号" maxlength="11" />
      </div>
    </div>
    <div class="abtn" @click="doRecord()">
      <span>看看你能借多少</span>
    </div>
    <p>借款额度因个人资质而定</p>
    <div class="flex">
      <div>
        <i class="ks"></i>
        <span>快速审批</span>
      </div>
      <div>
        <i class="ed"></i>
        <span>额度高</span>
      </div>
      <div>
        <i class="mo"></i>
        <span>快速到账</span>
      </div>
    </div>
  </div>
</template>

<script  type="text/ecmascript-6">
  import {RecordOperation} from '@/service'
  import {JwtToken} from '@/config/mUtils'
  import Util from '@/utils/Util'

  export default{
    data() {
      return {
        mobile: ''
      }
    },
    created() {
      JwtToken.remove()

      let channel = this.$route.query.channel ? this.$route.query.channel : 0
      RecordOperation('', channel)
      .then((resp) => {
        console.log(resp)
      })
      .catch((error) => {
        console.log(error)
      })
    },
    methods: {
      doRecord() {
        if (!/1[3|4|5|6|7|8]{1}\d{9}/.test(this.mobile)) {
          Util.msg('请输入手机号')
          return
        }

        let channel = this.$route.query.channel ? this.$route.query.channel : 0
        RecordOperation(this.mobile, channel, 2)
        .then((resp) => {
          console.log(resp)
          location.href = 'https://bee-bor-img.oss-cn-zhangjiakou.aliyuncs.com/apk/mfjb.apk'
        })
        .catch((error) => {
          console.log(error)
          location.href = 'https://bee-bor-img.oss-cn-zhangjiakou.aliyuncs.com/apk/mfjb.apk'
        })
      }
    }
  }
</script>

<style scoped lang="stylus">
  #wrap {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background #fff;
  }

  .logo-wrp {
    position: absolute;
    top: 0.3rem;
    left: 0.8rem;
  }

  .logo-wrp .logo {
    width: 60px;
    height: 60px;
  }

  .logo-wrp .name {
    font-size: 17px;
    color: #fff;
  }

  .top {
    width: 100%;
    margin: 0 auto;
    height: 13.44rem;
    background: url('../../assets/ww/top.png') no-repeat center center;
    background-size: cover;
  }

  .cd {
    width: 100%;
    height: 3.49867rem;
    margin: 0 auto;
    background: url('../../assets/ww/cd.png') no-repeat center center;
    background-size: cover;
  }

  .inp {
    height: 2.3893rem;
    width: 13.2267rem;
    border-radius: 28px;
    border: 1px solid #FF6C06;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .inp > div {
      width: 11.09333rem;
      height: 1.45067rem;
      font-size: 0.72533rem;
      color: #c3c3c3;
    }
  .inp  input {
      height: 100%;
      border: none;
      outline: none;
      margin-left: 0.85333rem;
      font-size: 0.72533rem;
    }
  .inp span {
      display: block;
      width: 0.512rem;
      height: 0.768rem;
      flex-shrink: 0;
      background: url('../../assets/ww/icon.png') no-repeat center center;
      background-size: contain;
    }

  .abtn {
    margin: 1.28rem auto;
    margin-bottom: 0;
    height: 2.38933rem;
    width: 13.22667rem;
    border-radius: 28px;
    background-color: #FF6C06;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .abtn  span {
      font-size: 0.85333rem;
      color: #fff;
      letter-spacing: 4px;
  }

  #wrap p {
    text-align: center;
    font-size: 0.68502rem;
    margin-top: 10px;
    color: #c3c3c3;
  }

  .flex {
    margin-top: 3.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    margin-bottom: 60px;
  }

  .flex span {
    margin-top: 0.42667rem;
    font-size: 0.68502rem;
    text-align: center;
  }

  .flex i {
    display: block;
    width: 2.51733rem;
    height: 2.51733rem;
  }

  .flex div {
    overflow: hidden;
    margin-right: 1.877333rem;
    text-align: center;
  }

  .flex div:nth-of-type(3) {
    margin-right: 0;
  }

  .ks {
    background: url("../../assets/ww/1.png") no-repeat center center;
    background-size: contain;
  }

  .ed {
    background: url("../../assets/ww/2.png") no-repeat center center;
    background-size: contain;
  }

  .mo {
    background: url("../../assets/ww/3.png") no-repeat center center;
    background-size: contain;
  }
</style>
